<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">列表</a></li>
    </ul>
    <!--<form class="well form-search" method="post" action="{:U('Member/lists')}">
        用户账号：
        <input type="text" name="username" style="width: 100px;" value="{$formget.username}" placeholder="请输入用户名">
        用户昵称：
        <input type="text" name="nickname" style="width: 150px;" value="{$formget.nickname}" placeholder="请输入用户昵称">
        注册时间：
        <input type="text" class="js-date" name="start_time" style="width: 120px;" value="{$formget.start_time}" placeholder="">&nbsp;
        至:&nbsp;
        <input type="text" class="js-date" name="end_time" style="width: 120px;" value="{$formget.end_time}" placeholder="">
        <input type="submit" class="btn btn-primary" value="搜索"/>
    </form>-->

    <a data-toggle="modal" data-target="#myModal"  class="btn btn-primary" >添加</a>
    <table style="margin-top: 10px;word-break:break-all;" class="table table-hover table-bordered table-list"
           id="menus-table">
        <thead>
        <tr>
            <th>序号</th>
            <th>达人</th>
            <th>优惠码</th>
            <th>折扣</th>
            <th>推广销售金额</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo" key="k">
            <tr>
                <td >{$k}</td>
                <td >{$vo.username}</td>
                <td >{$vo.sale_code}</td>
                <td >{$vo.number}</td>
                <td >{$vo.total_price}</td>
                <td ><a href="{:U('order', ['sale_code' => $vo['sale_code']])}">查看推广</a> | <a data-toggle="modal" data-target="#myModal_2" name="{$vo.username}" number="{$vo.number}" tid="{$vo.id}" sale_code="{$vo.sale_code}" class="add_ext">编辑</a> | <a class="js-ajax-delete" href="{:U('del', ['id' => $vo['id']])}">删除</a></td>
            </tr>
        </volist>
        </tbody>
    </table>
    <div class="pagination">{$Page}</div>
</div>

<div>
    <!--添加-->
    <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">添加达人</h3>
        </div>
        <form action="{:U('add')}" method="post"
              class="form-horizontal js-ajax-form">
            <div class="modal-body">
                <table>
                    <tbody>
                    <tr>
                        <td>达人名字：</td>
                        <td><input type="text" name="username"  class="" value=""></td>
                    </tr>
                    <tr >
                        <th style="white-space:nowrap;">优惠码：</th>
                        <td >
                            <input type="text" name="sale_code"  class="" value="">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="white-space:nowrap;">折扣：</th>
                        <td class="grade" id="grade">
                            <input type="text" name="number"  class="" value="">
                            <span class="form-required">*</span>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                <button type="submit" class="btn btn-primary ">保存</button>
            </div>
        </form>
    </div>

    <!--编辑-->
    <div id="myModal_2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">编辑达人</h3>
        </div>
        <form action="{:U('edit')}" method="post"
              class="form-horizontal js-ajax-form">
            <div class="modal-body">
                <table>
                    <tbody>
                    <tr>
                        <td>达人名字：</td>
                        <input type="hidden" name="id" class="id" value="">
                        <td><input type="text" name="username" id="name" class="" value=""></td>
                    </tr>
                    <tr>
                        <th style="white-space:nowrap;">优惠码：</th>
                        <td >
                            <input type="text" name="sale_code" disabled id="sale_code" class="" value="">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="white-space:nowrap;">折扣：</th>
                        <td class="grade" id="grade">
                            <input type="text" name="number" id="number" class="" value="">
                            <span class="form-required">*</span>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                <button type="submit" class="btn btn-primary ">保存</button>
            </div>
        </form>
    </div>



    <script src="__PUBLIC__/js/common.js"></script>
    <script>
        $(".hidden").hide();
        $('.add_ext').click(function () {

            var name = $(this).attr("name");
            var id = $(this).attr("tid");
            var number = $(this).attr("number");
            var sale_code = $(this).attr("sale_code");

            $(".id").val(id);
            // $("#id").val(id);
            $("#name").val(name);
            $("#number").val (number);
            $("#sale_code").val (sale_code);

        });

    </script>


    <script src="__PUBLIC__/js/common.js"></script>
</body>
</html>